Defining Trigger Levels

A trigger level is a level to which material in a tank either falls or rises and triggers some action. To continuously monitor when a tank reaches a trigger level, define and activate a trigger subroutine in the initialization logic. The subroutine should call Tank_RiseTrigger or Tank_FallTrigger depending on whether the associated action should execute when the tank level rises or falls to a certain level.

 

To show how to define a trigger subroutine, suppose that whenever TankA rises to 2000 gallons, an entity called Truck travels to a location called Pickup. The logic for this trigger subroutine might look as follows:

Trigger subroutine

Tank_Loop //logic repeats continuously

Begin

Tank_RiseTrigger (TankA, 2000) /* waits for TankA to rise to 2000 units*/

Order 1 Truck to Pickup // order a Truck to Pickup

End

Once the tank reaches the trigger level, the Tank_RiseTrigger subroutine prevents further triggering until the level drops back below the trigger level first.

When you use trigger subroutines, use them sparingly because they are CPU intensive. Every time the tank level changes, ProModel tests to see if the tank reached the trigger level. Trigger subroutines are often unnecessary because, unlike an actual tank where sensors report the tank level, you directly control how much to pump into a tank. For instance, an alternative way to model the previous example without using a triggering subroutine would be to call the Tank_TransferToLevel subroutine to first fill the tank to the 2000 unit level, order the Truck entity and then transfer the rest.